﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<script type="text/javascript" src="${path }/resource/plugin/ajaxfileupload.js"></script>
<style type="text/css">
.span1{
	color: #5400FF;
}
.span2{
	color: #FF3333;
}
</style>

<title></title>
</head>
<div class="ibox-content">
	<form class="form-horizontal" id="dataform">
		
		<div class="form-group">
			<label class="col-sm-6 control-label"><h3>员工导入页</h3></label>			
		</div>
		
		<div class="form-group">
	        <label class="col-sm-3 control-label">模板使用说明</label>
	        <div class="col-sm-7">
	        	<p style="font-size: 16px;font-weight: 500;">
	        		<h5><span >模板里的所有字段都为必填！！</span></h5>
	        		<h5>手机号:&nbsp;&nbsp;<span class="span2">在excel填写正确的手机格式,例如：15616886666</span></h5>
	        		<h5>所属部门:&nbsp;&nbsp;<span class="span2">请填写系统管理中数据字典管理中的数据类型为部门的值之一。</span></h5>
	        		<h5>担任职位:&nbsp;&nbsp;<span class="span2">请填写系统管理中数据字典管理中的数据类型为职位的值之一。</span></h5>
	        		<h5>性别:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="span2">请填写男或者女</span></h5>
	        		<h5>入职时间:&nbsp;&nbsp;<span class="span2">请填写格式为:XXXX-XX-XX，例如:2017-02-15</span></h5>
	        	</p>
	        </div>
	    </div> 
		
		<div class="form-group">
			<label class="col-sm-3 control-label">上传文件</label>
			<div class="col-sm-9">
				<input onclick="importExcel()" class="input-text upload-url radius form-control" 
					type="text" id="showFileName" readonly style="width: 45%;display: inline;"> 
				<a onclick="importExcel()" class="btn btn-primary radius"> 
					<i class="fa fa-cloud-upload"></i> 浏览文件 </a> 
				<a href='${path}/admin/userinfo/downExcelModel' class="btn btn-primary radius">
					<i class="fa fa-cloud-download"></i>下载模板 </a>					
				<input type="file" name="file" type="hidden" id="uploadId" style="display:none">
			</div>
		</div>
				
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<button type="button"onclick="submitData()" class="btn btn-success radius">保存</button>&nbsp;&nbsp;&nbsp;&nbsp;
				<button onclick="MTools.closeForm()" class="btn btn-danger radius">取消</button>

			</div>
		</div>
	</form>
</div>
<script type="text/javascript">

	//绑定文件的点击事件
	function importExcel(){
		var file=$("#uploadId").click();
	}
	//选中文件，文件名字显示在文本框中
	$("#uploadId").change(function(){
		$("#showFileName").val($(this).val());
	})
	
	//提交文件
	function submitData(){
		layer.load();
		$.ajaxFileUpload({
			url : "${path}/admin/userinfo/importData",
			type : "POST",
			secureuri : false,// 一般设置为false
			fileElementId : "uploadId",// 文件上传空间的id属性 <input type="file" id="uploadId" />
			dataType : "json",
			success : function(data) {
				layer.closeAll('loading');
				 var icon=0;
				 if(data.status=='ok'){
					 layer.msg(data.info,{icon:1},function(layIndex){
							parent.myGrid.serchData();
							parent.layer.close(parent.layer.getFrameIndex(window.name));
					 });
				 }
				 else{
					 layer.closeAll('loading');
					 layer.msg(data.info,{icon:2});
                  }
				
			}
		});
	}
</script>
</body>
</html>